<?php
/**
    c2earn 基类库
	@author xiaoming <maixiaoming@9qi.cn>
*/
class BaseAction extends Action 
{
	
	function _initialize(){
		$this->_checkLogin();


	}
	/**
		檢查登錄
	*/
	protected function _checkLogin()
	{
		if (!( Session::is_set('admin_id') && (Session::get('admin_id') > 0)) ){
			$this->redirect('login/index', array(), 0, 'please login');
			exit();
		} else {
			$this->userName = Session::get('admin_name');
			$this->userId = Session::get('admin_id');
			
		}
	}
	
	/**
		显示消息页面并跳转
		@access protected
		@param string $title     页面标题
			   string $jumpUrl   跳转URL
			   string $message   页面提示信息
			   int    $waitSecond   等待时间 
	    @return void
	*/
	protected function _message($title,$jumpUrl,$message,$waitSecond=5)
	{
		$this->assign("jumpUrl",$jumpUrl);
		$this->assign('waitSecond',$waitSecond);
		$this->assign('title',$title);
		$this->success($message);
	}
	
	/**
		页面无法找到(404)时的处理函数
	*/
	protected function _pageNotFound()
	{
		$this->redirect('index/index', array(), 3, 'Page Not Found!');
	}
	
}